package com.stcc.portal.config;

import com.stcc.portal.filter.WebCorsFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 描述:拦截配置
 * 项目名:stcc_gl-parent
 * 包名:com.stcc.portal.config
 * 作者:stcc
 * 创建时间:2021/3/11 10:20
 * 版本:1.0
 */
@Configuration
public class FilterConfig {
    @Bean
    public FilterRegistrationBean<WebCorsFilter> Filter01() {
        FilterRegistrationBean<WebCorsFilter> filterRegistrationBean = new FilterRegistrationBean<>();
        filterRegistrationBean.setFilter(new WebCorsFilter());// 设置过滤器名称
        filterRegistrationBean.addUrlPatterns("/*");// 配置过滤规则
        filterRegistrationBean.setOrder(1); // order的数值越小 则优先级越高
        return filterRegistrationBean;
    }
}
